import {
	HTTP
} from '../util/http-p.js'

class BookModel extends HTTP {
	getHotList(){
		return this.request({
			url: 'book/hot_list'
		})
	}

	search(start, q) {
		return this.request({
			url: '/book/search?summary=1',
			data: {
				q: q,
				start: start
			}
		})
	}

	getMyBookCount(){
		return this.request({
			url: 'book/favor/count'
		})
	}

	getDetail(bookid){
		return this.request({
			url: `book/${bookid}/detail`
		})
	}

	getLikeStatus(bookid){
		return this.request({
			url: `book/${bookid}/favor`
		})
	}

	getComments(bookid){
		return this.request({
			url: `book/${bookid}/short_comment`
		})
	}

	postComments(bookid, text){
		return this.request({
			url: 'book/add/short_comment',
			method: 'POST',
			data: {
				book_id: bookid,
				content: text
			}
		})
	}
}
export {BookModel}